home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / ScreenSavers / BackSpaceViews / QixView.BackModule / QixView.h < prev    next >
Encoding:
Text File  |  1995-06-12  |  3.2 KB  |  104 lines

  1.  
  2. #import    <appkit/View.h>
  3. #import    <appkit/graphics.h>
  4.  
  5. /*
  6.  *    This class implements what I've heard called, Qix lines.
  7.  *
  8.  *    Please send any suggestions for improving or correcting this
  9.  *    screen saver to larry@netcom.com.  Have fun!
  10.  *
  11.  */
  12.  
  13. /**********************************************************************/
  14.  
  15. typedef    struct    moveable_point    // All values neccessary to keep track
  16.         {                        // of a moving points position and direction.
  17.  
  18.                 int    x;                // x coordinate of the point.
  19.                 int    y;                // y coordinate of the point.
  20.                 
  21.                 int    x_dir;            // Points "x" direction, LEFT or RIGHT.
  22.                 int    y_dir;            // Points "y" direction, UP or DOWN.
  23.                 
  24.                 float    x_inc;        // Amount to move point in x's direction.
  25.                 float    y_inc;        // Amount to move point in y's direction.
  26.                 
  27.                 float    orig_inc;    // Used to reset x_inc and y_inc.
  28.         }
  29.         MVPOINT;
  30.  
  31.  
  32. typedef    struct    qix_line        // Two moveable points make a moving line.
  33.         {
  34.             MVPOINT    pointA;
  35.             MVPOINT    pointB;
  36.         }
  37.         QIX;
  38.  
  39. /*********************************************************************/
  40.  
  41. @interface QixView : View
  42. {
  43.     QIX        head;            // Head Qix values. Drawn in white.
  44.     QIX        tail;            // Tail Qix values. Drawn in black.
  45.     
  46.     int        tailLen;        // Current length of tail.
  47. }
  48.  
  49. /*********************************************************************/
  50.  
  51. //--------------------------------------------------------------//
  52. //                                                                //
  53. - setQixPoint : ( MVPOINT * ) qix;                                //
  54. //                                                                //
  55. //    Sets a movable points next position.                        //
  56. //                                                                //
  57. //--------------------------------------------------------------//
  58.  
  59. //--------------------------------------------------------------//
  60. //                                                                //
  61. - resetQix : ( QIX * ) qix : ( BOOL ) resetControls;            //
  62. //                                                                //
  63. //    Resets a qix points fields to default values.                //
  64. //                                                                //
  65. //--------------------------------------------------------------//
  66.  
  67. //--------------------------------------------------------------//
  68. //                                                                //
  69. - initFrame  : ( const NXRect * ) frameRect;                    //
  70. //                                                                //
  71. //    Calls resetQix to reset the head and tail qix.                 //
  72. //                                                                //
  73. //--------------------------------------------------------------//
  74.  
  75. - (const char *) windowTitle;
  76.  
  77. //--------------------------------------------------------------//
  78. //                                                                //
  79. - drawSelf : ( NXRect * ) r : ( int ) count;                    //
  80. //                                                                //
  81. //    Clears its view to a black background and calls resetQix,    //
  82. //    to reset the head and tail qix to their default values.        //
  83. //                                                                //
  84. //--------------------------------------------------------------//
  85.  
  86. //--------------------------------------------------------------//
  87. //                                                                //
  88. - drawQix : ( QIX ) qix;                                        //
  89. //                                                                //
  90. //    Draws a line between the two points in a qix structure.        //
  91. //                                                                //
  92. //--------------------------------------------------------------//
  93.  
  94. //--------------------------------------------------------------//
  95. //                                                                //
  96. - oneStep;                                                        //
  97. //                                                                //
  98. //    This is it the master method.  This method is the control    //
  99. //    center for animating the qix lines.                            //
  100. //                                                                //
  101. //--------------------------------------------------------------//
  102.  
  103. @end
  104.